﻿Imports System.Data.OleDb
Module importacion
    '///////////////////////////////////////////////////////////////////////////////////////
    'Cadena de conexion y apertura de la base que se importa
    '-----------------------------------------------------------------------
    Public Function importcadenaConexBD(ByVal ruta As String) As OleDbConnection
        Dim conexion = New OleDbConnection()
        conexion.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ruta
        Try
            conexion.Open()
        Catch mierror As Exception
            MessageBox.Show("Error de Conexión a la Base de Datos: " & mierror.Message)
        End Try
        Return (conexion)
    End Function
    Public Class C_llamadas
        'IMPORTADOR DE TODAS LLAMADAS EN ATENCION
        Public Function todasLLamadas() As OleDbDataReader
            Dim drllamadas As OleDbDataReader
            importcadenaConexBD(frmImportar.lblcadena.Text)
            Dim instruccion As New OleDbCommand("select * from llamada ", importcadenaConexBD(frmImportar.lblcadena.Text))
            drllamadas = instruccion.ExecuteReader()
            Return drllamadas
            drllamadas.Close()
        End Function
        'IMPORTADOR DE TODAS LLAMADAS EN VENTAS
        Public Function todasLLamadasVta() As OleDbDataReader
            Dim drllamadas As OleDbDataReader
            importcadenaConexBD(frmImportar.lblcadena.Text)
            Dim instruccion As New OleDbCommand("select * from llamada_vta ", importcadenaConexBD(frmImportar.lblcadena.Text))
            drllamadas = instruccion.ExecuteReader()
            Return drllamadas
            drllamadas.Close()
        End Function
        'IMPORTADOR DE TODAS LLAMADAS EN POSVENTAS
        Public Function todasLLamadasPVta() As OleDbDataReader
            'variables
            Dim drllamadas As OleDbDataReader
            importcadenaConexBD(frmImportar.lblcadena.Text)
            Dim instruccion As New OleDbCommand("select * from llamada_pvta ", importcadenaConexBD(frmImportar.lblcadena.Text))
            drllamadas = instruccion.ExecuteReader()
            Return drllamadas
            drllamadas.Close()
        End Function
        'CONTROLADOR DE ID UNICO DE LLAMADA EN ATENCION
        Public Function idUnicoLLamadaA(ByVal IdUnicoBuscado) As OleDbDataReader
            Using cadenaConexBD()
                Dim drIdunico As OleDbDataReader
                Dim instruccion As New OleDbCommand("Select idunico_llam from llamada where idunico_llam = '" & IdUnicoBuscado & "'", cadenaConexBD)
                drIdunico = instruccion.ExecuteReader()
                Return drIdunico
                drIdunico.Close()
            End Using
        End Function
        'CONTROLADOR DE ID UNICO DE LLAMADA EN VENTA
        Public Function idUnicoLLamadaV(ByVal IdUnicoBuscado) As OleDbDataReader
            Using cadenaConexBD()
                Dim drIdunico As OleDbDataReader
                Dim instruccion As New OleDbCommand("Select idunico_llam from llamada_vta where idUnico_llam = '" & IdUnicoBuscado & "'", cadenaConexBD)
                drIdunico = instruccion.ExecuteReader()
                Return drIdunico
                drIdunico.Close()
            End Using
        End Function
        'CONTROLADOR DE ID UNICO DE LLAMADA EN POSVENTA
        Public Function idUnicoLLamadaPVta(ByVal IdUnicoBuscado) As OleDbDataReader
            Using cadenaConexBD()
                Dim drIdunico As OleDbDataReader
                Dim instruccion As New OleDbCommand("Select idunico_llam from llamada_pvta where idUnico_llam = '" & IdUnicoBuscado & "'", cadenaConexBD)
                drIdunico = instruccion.ExecuteReader()
                Return drIdunico
                drIdunico.Close()
            End Using
        End Function
        'importacion de los datos tomados de la base de backup exportada por otro auditor
        'los valores que se le pasan a la funcion se obtienen de la lectura del grid y pasados como parametros

        'INSERCCION EN TABLA LLAMADAS DE ATENCION
        Public Sub importarLLamada(ByVal v01 As Date, ByVal v02 As Date, ByVal v03 As String, ByVal v04 As Integer, ByVal v05 As Integer, ByVal v06 As Integer, ByVal v07 As Integer, ByVal v08 As Double, ByVal v09 As Double, ByVal v10 As Double, ByVal v11 As Double, ByVal v12 As Double, ByVal v13 As Double, ByVal v14 As Double, ByVal v15 As Double, ByVal v16 As Double, ByVal v17 As String, ByVal v18 As String, ByVal v19 As Double, ByVal v20 As String, ByVal v21 As String)
            Try
                cadenaConexBD()
                'inserccion de datos a la tabla
                Dim instruccion As New OleDbCommand("Insert into llamada (fau_llam, fec_llam, nlot_llam, id_tllam, id_empr, id_au, id_ado, vaop_salu, vaop_emp, vaop_ind, vaop_disp, vaop_comp, vaop_info, vaop_com, vaop_cred, vaop_cie, tfav_llam, tctra_llam, vato_llam, idunico_llam,caso_llam) values ('" & v01 & "','" & v02 & "','" & v03 & "','" & v04 & "','" & v05 & "','" & v06 & "','" & v07 & "','" & v08 & "','" & v09 & "','" & v10 & "','" & v11 & "','" & v12 & "','" & v13 & "','" & v14 & "','" & v15 & "','" & v16 & "','" & v17 & "','" & v18 & "','" & v19 & "','" & v20 & "','" & v21 & "')", cadenaConexBD)
                instruccion.ExecuteNonQuery()
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            Finally
                cadenaConexBD.Close()
            End Try
        End Sub

        'INSERCCION EN TABLA LLAMADAS DE VENTAS
        Public Sub importarLLamadaV(ByVal v01 As Date, ByVal v02 As Date, ByVal v03 As String, ByVal v04 As Integer, ByVal v05 As Integer, ByVal v06 As Integer, ByVal v07 As Integer, ByVal v08 As Double, ByVal v09 As Double, ByVal v10 As Double, ByVal v11 As Double, ByVal v12 As Double, ByVal v13 As Double, ByVal v14 As Double, ByVal v15 As Double, ByVal v16 As Double, ByVal v17 As String, ByVal v18 As String, ByVal v19 As Double, ByVal v20 As String, ByVal v21 As String)
            Try
                cadenaConexBD()
                'inserccion de datos a la tabla
                Dim instruccion As New OleDbCommand("Insert into llamada_vta (fau_llam, fec_llam, nlot_llam, id_tllam, id_empr, id_au, id_ado, vaop_salu, vaop_emp, vaop_ind, vaop_man, vaop_ent, vaop_spe, vaop_pre, vaop_mec, vaop_pide, tfav_llam, tctra_llam, vato_llam, idunico_llam, caso_llam) values ('" & v01 & "','" & v02 & "','" & v03 & "','" & v04 & "','" & v05 & "','" & v06 & "','" & v07 & "','" & v08 & "','" & v09 & "','" & v10 & "','" & v11 & "','" & v12 & "','" & v13 & "','" & v14 & "','" & v15 & "','" & v16 & "','" & v17 & "','" & v18 & "','" & v19 & "','" & v20 & "','" & v21 & "')", cadenaConexBD)
                instruccion.ExecuteNonQuery()
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            Finally
                cadenaConexBD.Close()
            End Try
        End Sub

        'INSERCCION EN TABLA LLAMADAS DE POSVENTA
        Public Sub importarLLamadaPVta(ByVal v01 As Date, ByVal v02 As Date, ByVal v03 As String, ByVal v04 As Integer, ByVal v05 As Integer, ByVal v06 As Integer, ByVal v07 As Integer, ByVal v08 As Double, ByVal v09 As Double, ByVal v10 As Double, ByVal v11 As Double, ByVal v12 As Double, ByVal v13 As Double, ByVal v14 As Double, ByVal v15 As Double, ByVal v16 As String, ByVal v17 As String, ByVal v18 As Double, ByVal v19 As String, ByVal v20 As String)
            Try
                cadenaConexBD()
                'inserccion de datos a la tabla
                Dim instruccion As New OleDbCommand("Insert into llamada_pvta (fau_llam, fec_llam, nlot_llam, id_tllam, id_empr, id_au, id_ado, vaop_salu, vaop_emp, vaop_esc, vaop_ind, vaop_disp, vaop_pre, vaop_com, vaop_cie, tfav_llam, tctra_llam, vato_llam, idunico_llam, caso_llam) values ('" & v01 & "','" & v02 & "','" & v03 & "','" & v04 & "','" & v05 & "','" & v06 & "','" & v07 & "','" & v08 & "','" & v09 & "','" & v10 & "','" & v11 & "','" & v12 & "','" & v13 & "','" & v14 & "','" & v15 & "','" & v16 & "','" & v17 & "','" & v18 & "','" & v19 & "','" & v20 & "')", cadenaConexBD)
                instruccion.ExecuteNonQuery()
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            Finally
                cadenaConexBD.Close()
            End Try
        End Sub

    End Class
    'Obtengo los datos de la tabla llamadas importada y los paso al grid
    '--------------------------------------------------------------------

    'CASO LLAMADAS ATENCION
    Public Sub LeerBDimportados(ByVal flex As AxMSFlexGridLib.AxMSFlexGrid)
        'Variables del tipo clase delcarado segun la tabla.
        Dim importados As New C_llamadas()
        Dim drimportados As OleDbDataReader = importados.todasLLamadas()

        Dim contLlamImport As Integer
        contLlamImport = 0

        If drimportados Is Nothing Then
            Exit Sub
        End If

        Dim id_llam As String
        Dim fau_llam As Date
        Dim fec_llam As Date
        Dim nlot_llam As String
        Dim id_tllam As Integer
        Dim id_empr As Integer
        Dim id_au As Integer
        Dim id_ado As Integer
        Dim vaop_salu As Double
        Dim vaop_emp As Double
        Dim vaop_ind As Double
        Dim vaop_disp As Double
        Dim vaop_comp As Double
        Dim vaop_info As Double
        Dim vaop_com As Double
        Dim vaop_cred As Double
        Dim vaop_cie As Double
        Dim tfav_llam As String
        Dim tctra_llam As String
        Dim idunico_llam As String
        Dim vato_llam As Double
        Dim caso_llam As String

        id_llam = 0
        ' fau_llam = ""
        ' fec_llam = ""
        nlot_llam = ""
        id_tllam = 0
        id_empr = 0
        id_au = 0
        id_ado = 0
        vaop_salu = 0
        vaop_emp = 0
        vaop_ind = 0
        vaop_disp = 0
        vaop_comp = 0
        vaop_info = 0
        vaop_com = 0
        vaop_cred = 0
        vaop_cie = 0
        tfav_llam = ""
        tctra_llam = ""
        vato_llam = 0
        idunico_llam = ""
        caso_llam = ""

        While drimportados.Read
            contLlamImport = contLlamImport + 1 'contador

            If Not drimportados.IsDBNull(0) Then
                id_llam = drimportados.GetInt32(0)
            End If
            If Not drimportados.IsDBNull(1) Then
                fau_llam = drimportados.GetDateTime(1)
            End If
            If Not drimportados.IsDBNull(2) Then
                fec_llam = drimportados.GetDateTime(2)
            End If
            If Not drimportados.IsDBNull(3) Then
                nlot_llam = drimportados.GetString(3)
            End If
            If Not drimportados.IsDBNull(4) Then
                id_tllam = drimportados.GetInt32(4)
            End If
            If Not drimportados.IsDBNull(5) Then
                id_empr = drimportados.GetInt32(5)
            End If
            If Not drimportados.IsDBNull(6) Then
                id_au = drimportados.GetInt32(6)
            End If
            If Not drimportados.IsDBNull(7) Then
                id_ado = drimportados.GetInt32(7)
            End If
            '-----valores de las opciones-----'
            If Not drimportados.IsDBNull(8) Then
                vaop_salu = drimportados.GetDouble(8)
            End If
            If Not drimportados.IsDBNull(9) Then
                vaop_emp = drimportados.GetDouble(9)
            End If
            If Not drimportados.IsDBNull(10) Then
                vaop_ind = drimportados.GetDouble(10)
            End If
            If Not drimportados.IsDBNull(11) Then
                vaop_disp = drimportados.GetDouble(11)
            End If
            If Not drimportados.IsDBNull(12) Then
                vaop_comp = drimportados.GetDouble(12)
            End If
            If Not drimportados.IsDBNull(13) Then
                vaop_info = drimportados.GetDouble(13)
            End If
            If Not drimportados.IsDBNull(14) Then
                vaop_com = drimportados.GetDouble(14)
            End If
            If Not drimportados.IsDBNull(15) Then
                vaop_cred = drimportados.GetDouble(15)
            End If
            If Not drimportados.IsDBNull(16) Then
                vaop_cie = drimportados.GetDouble(16)
            End If
            '------------fin de los valores de opciones------'
            If Not drimportados.IsDBNull(17) Then
                tfav_llam = drimportados.GetString(17)
            End If
            If Not drimportados.IsDBNull(18) Then
                tctra_llam = drimportados.GetString(18)
            End If

            If Not drimportados.IsDBNull(19) Then
                vato_llam = drimportados.GetDouble(19)
            End If

            If Not drimportados.IsDBNull(20) Then
                idunico_llam = drimportados.GetString(20)
            End If

            If Not drimportados.IsDBNull(21) Then
                caso_llam = drimportados.GetString(21)
            End If

            'hago la comprobacion si existe el id
            Dim idUnicoObtenidoA As New C_llamadas()
            Dim drIdunicoA As OleDbDataReader = idUnicoObtenidoA.idUnicoLLamadaA(idunico_llam)
            'compruebo si el datareader tiene alguna fila/ si es falso es por que no hay coincidencias en el select , el registro no esta repetido y lo agrego al flex
            If drIdunicoA.HasRows = False Then
                flex.AddItem(id_llam & Chr(9) & fau_llam & Chr(9) & fec_llam & Chr(9) & nlot_llam & Chr(9) & id_tllam & Chr(9) & id_empr & Chr(9) & id_au & Chr(9) & id_ado & Chr(9) & vaop_salu & Chr(9) & vaop_emp & Chr(9) & vaop_ind & Chr(9) & vaop_disp & Chr(9) & vaop_comp & Chr(9) & vaop_info & Chr(9) & vaop_com & Chr(9) & vaop_cred & Chr(9) & vaop_cie & Chr(9) & tfav_llam & Chr(9) & tctra_llam & Chr(9) & vato_llam & Chr(9) & idunico_llam & Chr(9) & caso_llam & Chr(9))
            End If
        End While
        drimportados.Close()
        frmImportar.lblcontador.Text = contLlamImport
    End Sub

    'CASO LLAMADAS VENTAS
    Public Sub LeerBDimportadosV(ByVal flex As AxMSFlexGridLib.AxMSFlexGrid)
        'Variables del tipo clase delcarado segun la tabla.
        Dim importados As New C_llamadas()
        Dim drimportados As OleDbDataReader = importados.todasLLamadasVta()

        Dim contLlamImport As Integer
        contLlamImport = 0

        If drimportados Is Nothing Then
            Exit Sub
        End If

        Dim id_llam As String
        Dim fau_llam As Date
        Dim fec_llam As Date
        Dim nlot_llam As String
        Dim id_tllam As Integer
        Dim id_empr As Integer
        Dim id_au As Integer
        Dim id_ado As Integer
        Dim vaop_salu As Double
        Dim vaop_emp As Double
        Dim vaop_ind As Double
        Dim vaop_man As Double
        Dim vaop_ent As Double
        Dim vaop_spe As Double
        Dim vaop_pre As Double
        Dim vaop_mec As Double
        Dim vaop_pide As Double
        Dim tfav_llam As String
        Dim tctra_llam As String
        Dim vato_llam As Double
        Dim idunico_llam As String
        Dim caso_llam As String

        id_llam = 0
        ' fau_llam = ""
        ' fec_llam = ""
        nlot_llam = ""
        id_tllam = 0
        id_empr = 0
        id_au = 0
        id_ado = 0
        vaop_salu = 0
        vaop_emp = 0
        vaop_ind = 0
        vaop_man = 0
        vaop_ent = 0
        vaop_spe = 0
        vaop_pre = 0
        vaop_mec = 0
        vaop_pide = 0
        tfav_llam = ""
        tctra_llam = ""
        vato_llam = 0
        idunico_llam = ""
        caso_llam = ""

        While drimportados.Read
            contLlamImport = contLlamImport + 1 'contador

            If Not drimportados.IsDBNull(0) Then
                id_llam = drimportados.GetInt32(0)
            End If
            If Not drimportados.IsDBNull(1) Then
                fau_llam = drimportados.GetDateTime(1)
            End If
            If Not drimportados.IsDBNull(2) Then
                fec_llam = drimportados.GetDateTime(2)
            End If
            If Not drimportados.IsDBNull(3) Then
                nlot_llam = drimportados.GetString(3)
            End If
            If Not drimportados.IsDBNull(4) Then
                id_tllam = drimportados.GetInt32(4)
            End If
            If Not drimportados.IsDBNull(5) Then
                id_empr = drimportados.GetInt32(5)
            End If
            If Not drimportados.IsDBNull(6) Then
                id_au = drimportados.GetInt32(6)
            End If
            If Not drimportados.IsDBNull(7) Then
                id_ado = drimportados.GetInt32(7)
            End If
            '-----valores de las opciones-----'
            If Not drimportados.IsDBNull(8) Then
                vaop_salu = drimportados.GetDouble(8)
            End If
            If Not drimportados.IsDBNull(9) Then
                vaop_emp = drimportados.GetDouble(9)
            End If
            If Not drimportados.IsDBNull(10) Then
                vaop_ind = drimportados.GetDouble(10)
            End If
            If Not drimportados.IsDBNull(11) Then
                vaop_man = drimportados.GetDouble(11)
            End If
            If Not drimportados.IsDBNull(12) Then
                vaop_ent = drimportados.GetDouble(12)
            End If
            If Not drimportados.IsDBNull(13) Then
                vaop_spe = drimportados.GetDouble(13)
            End If
            If Not drimportados.IsDBNull(14) Then
                vaop_pre = drimportados.GetDouble(14)
            End If
            If Not drimportados.IsDBNull(15) Then
                vaop_mec = drimportados.GetDouble(15)
            End If
            If Not drimportados.IsDBNull(16) Then
                vaop_pide = drimportados.GetDouble(16)
            End If
            '------------fin de los valores de opciones------'
            If Not drimportados.IsDBNull(17) Then
                tfav_llam = drimportados.GetString(17)
            End If
            If Not drimportados.IsDBNull(18) Then
                tctra_llam = drimportados.GetString(18)
            End If

            If Not drimportados.IsDBNull(19) Then
                vato_llam = drimportados.GetDouble(19)
            End If

            If Not drimportados.IsDBNull(20) Then
                idunico_llam = drimportados.GetString(20)
            End If

            If Not drimportados.IsDBNull(21) Then
                caso_llam = drimportados.GetString(21)
            End If

            'hago la comprobacion si existe el id
            Dim idUnicoObtenido As New C_llamadas()
            Dim drIdunico As OleDbDataReader = idUnicoObtenido.idUnicoLLamadaV(idunico_llam)
            'compruebo si el datareader tiene alguna fila/ si es falso es por que no hay coincidencias en el select , el registro no esta repetido y lo agrego al flex
            If drIdunico.HasRows = False Then
                flex.AddItem(id_llam & Chr(9) & fau_llam & Chr(9) & fec_llam & Chr(9) & nlot_llam & Chr(9) & id_tllam & Chr(9) & id_empr & Chr(9) & id_au & Chr(9) & id_ado & Chr(9) & vaop_salu & Chr(9) & vaop_emp & Chr(9) & vaop_ind & Chr(9) & vaop_man & Chr(9) & vaop_ent & Chr(9) & vaop_spe & Chr(9) & vaop_pre & Chr(9) & vaop_mec & Chr(9) & vaop_pide & Chr(9) & tfav_llam & Chr(9) & tctra_llam & Chr(9) & vato_llam & Chr(9) & idunico_llam & Chr(9) & caso_llam & Chr(9))
            End If
        End While
        drimportados.Close()
        frmImportar.lblcontadorVta.Text = contLlamImport
    End Sub

    'CASO LLAMADAS POSVENTAS
    Public Sub LeerBDimportadosPV(ByVal flex As AxMSFlexGridLib.AxMSFlexGrid)
        'Variables del tipo clase delcarado segun la tabla.
        Dim importados As New C_llamadas()
        Dim drimportados As OleDbDataReader = importados.todasLLamadasPVta()

        Dim contLlamImport As Integer
        contLlamImport = 0

        If drimportados Is Nothing Then
            Exit Sub
        End If

        Dim id_llam As String
        Dim fau_llam As Date
        Dim fec_llam As Date
        Dim nlot_llam As String
        Dim id_tllam As Integer
        Dim id_empr As Integer
        Dim id_au As Integer
        Dim id_ado As Integer
        Dim vaop_salu As Double
        Dim vaop_emp As Double
        Dim vaop_esc As Double
        Dim vaop_ind As Double
        Dim vaop_disp As Double
        Dim vaop_pre As Double
        Dim vaop_com As Double
        Dim vaop_cie As Double
        Dim tfav_llam As String
        Dim tctra_llam As String
        Dim vato_llam As Double
        Dim idunico_llam As String
        Dim caso_llam As String

        id_llam = 0
        ' fau_llam = ""
        ' fec_llam = ""
        nlot_llam = ""
        id_tllam = 0
        id_empr = 0
        id_au = 0
        id_ado = 0
        vaop_salu = 0
        vaop_emp = 0
        vaop_esc = 0
        vaop_ind = 0
        vaop_disp = 0
        vaop_pre = 0
        vaop_com = 0
        vaop_cie = 0
        tfav_llam = ""
        tctra_llam = ""
        vato_llam = 0
        idunico_llam = ""
        caso_llam = ""

        While drimportados.Read
            contLlamImport = contLlamImport + 1 'contador

            If Not drimportados.IsDBNull(0) Then
                id_llam = drimportados.GetInt32(0)
            End If
            If Not drimportados.IsDBNull(1) Then
                fau_llam = drimportados.GetDateTime(1)
            End If
            If Not drimportados.IsDBNull(2) Then
                fec_llam = drimportados.GetDateTime(2)
            End If
            If Not drimportados.IsDBNull(3) Then
                nlot_llam = drimportados.GetString(3)
            End If
            If Not drimportados.IsDBNull(4) Then
                id_tllam = drimportados.GetInt32(4)
            End If
            If Not drimportados.IsDBNull(5) Then
                id_empr = drimportados.GetInt32(5)
            End If
            If Not drimportados.IsDBNull(6) Then
                id_au = drimportados.GetInt32(6)
            End If
            If Not drimportados.IsDBNull(7) Then
                id_ado = drimportados.GetInt32(7)
            End If
            '-----valores de las opciones-----'
            If Not drimportados.IsDBNull(8) Then
                vaop_salu = drimportados.GetDouble(8)
            End If
            If Not drimportados.IsDBNull(9) Then
                vaop_emp = drimportados.GetDouble(9)
            End If
            If Not drimportados.IsDBNull(10) Then
                vaop_esc = drimportados.GetDouble(10)
            End If
            If Not drimportados.IsDBNull(11) Then
                vaop_ind = drimportados.GetDouble(11)
            End If
            If Not drimportados.IsDBNull(12) Then
                vaop_disp = drimportados.GetDouble(12)
            End If
            If Not drimportados.IsDBNull(13) Then
                vaop_pre = drimportados.GetDouble(13)
            End If
            If Not drimportados.IsDBNull(14) Then
                vaop_com = drimportados.GetDouble(14)
            End If
            If Not drimportados.IsDBNull(15) Then
                vaop_cie = drimportados.GetDouble(15)
            End If
            '------------fin de los valores de opciones------'
            If Not drimportados.IsDBNull(16) Then
                tfav_llam = drimportados.GetString(16)
            End If
            If Not drimportados.IsDBNull(17) Then
                tctra_llam = drimportados.GetString(17)
            End If

            If Not drimportados.IsDBNull(18) Then
                vato_llam = drimportados.GetDouble(18)
            End If

            If Not drimportados.IsDBNull(19) Then
                idunico_llam = drimportados.GetString(19)
            End If

            If Not drimportados.IsDBNull(20) Then
                caso_llam = drimportados.GetString(20)
            End If

            'hago la comprobacion si existe el id
            Dim idUnicoObtenido As New C_llamadas()
            Dim drIdunico As OleDbDataReader = idUnicoObtenido.idUnicoLLamadaPVta(idunico_llam)
            'compruebo si el datareader tiene alguna fila/ si es falso es por que no hay coincidencias en el select , el registro no esta repetido y lo agrego al flex
            If drIdunico.HasRows = False Then
                flex.AddItem(id_llam & Chr(9) & fau_llam & Chr(9) & fec_llam & Chr(9) & nlot_llam & Chr(9) & id_tllam & Chr(9) & id_empr & Chr(9) & id_au & Chr(9) & id_ado & Chr(9) & vaop_salu & Chr(9) & vaop_emp & Chr(9) & vaop_esc & Chr(9) & vaop_ind & Chr(9) & vaop_disp & Chr(9) & vaop_pre & Chr(9) & vaop_com & Chr(9) & vaop_cie & Chr(9) & tfav_llam & Chr(9) & tctra_llam & Chr(9) & vato_llam & Chr(9) & idunico_llam & Chr(9) & caso_llam & Chr(9))
            End If
        End While
        drimportados.Close()
        frmImportar.lblcontadorPVta.Text = contLlamImport
    End Sub
    'TITULOS GRID ATENCION
    Public Sub TitulosGllam(ByVal flex As AxMSFlexGridLib.AxMSFlexGrid)
        With (flex)
            .Row = 0
            .Col = 0
            .Col = 1
            .Text = "Fecha de auditoria"
            .set_ColWidth(1, 2000)
            .Col = 3
            .Text = "Lote Nº"
            .set_ColWidth(3, 2000)
            '.Col = 5
            '.Text = "Auditor"
            '.set_ColWidth(5, 2500)
            'ancho cero para esconder las columnas
            .set_ColWidth(0, 0)
            .set_ColWidth(2, 0)
            .set_ColWidth(4, 0)
            .set_ColWidth(5, 0)
            .set_ColWidth(6, 0)
            .set_ColWidth(7, 0)
            .set_ColWidth(8, 0)
            .set_ColWidth(9, 0)
            .set_ColWidth(10, 0)
            .set_ColWidth(11, 0)
            .set_ColWidth(12, 0)
            .set_ColWidth(13, 0)
            .set_ColWidth(14, 0)
            .set_ColWidth(15, 0)
            .set_ColWidth(16, 0)
            .set_ColWidth(17, 0)
            .set_ColWidth(18, 0)
            .set_ColWidth(19, 0)
            .set_ColWidth(20, 0)
            .set_ColWidth(21, 0)
        End With
    End Sub
    'TITULOS GRID VENTAS
    Public Sub TitulosGllamV(ByVal flex As AxMSFlexGridLib.AxMSFlexGrid)
        With (flex)
            .Row = 0
            .Col = 0
            .Col = 1
            .Text = "Fecha de auditoria"
            .set_ColWidth(1, 2000)
            .Col = 3
            .Text = "Lote Nº"
            .set_ColWidth(3, 2000)
            '.Col = 5
            '.Text = "Auditor"
            '.set_ColWidth(5, 2500)
            'ancho cero para esconder las columnas
            .set_ColWidth(0, 0)
            .set_ColWidth(2, 0)
            .set_ColWidth(4, 0)
            .set_ColWidth(5, 0)
            .set_ColWidth(6, 0)
            .set_ColWidth(7, 0)
            .set_ColWidth(8, 0)
            .set_ColWidth(9, 0)
            .set_ColWidth(10, 0)
            .set_ColWidth(11, 0)
            .set_ColWidth(12, 0)
            .set_ColWidth(13, 0)
            .set_ColWidth(14, 0)
            .set_ColWidth(15, 0)
            .set_ColWidth(16, 0)
            .set_ColWidth(17, 0)
            .set_ColWidth(18, 0)
            .set_ColWidth(19, 0)
            .set_ColWidth(20, 0)
            .set_ColWidth(21, 0)
        End With
    End Sub
    'TITULOS GRID POSVENTA
    Public Sub TitulosGllamPV(ByVal flex As AxMSFlexGridLib.AxMSFlexGrid)
        With (flex)
            .Row = 0
            .Col = 0
            .Col = 1
            .Text = "Fecha de auditoria"
            .set_ColWidth(1, 2000)
            .Col = 3
            .Text = "Lote Nº"
            .set_ColWidth(3, 2000)
            '.Col = 5
            '.Text = "Auditor"
            '.set_ColWidth(5, 2500)


            'ancho cero para esconder las columnas
            .set_ColWidth(0, 0)
            .set_ColWidth(2, 0)
            .set_ColWidth(4, 0)
            .set_ColWidth(5, 0)
            .set_ColWidth(6, 0)
            .set_ColWidth(7, 0)
            .set_ColWidth(8, 0)
            .set_ColWidth(9, 0)
            .set_ColWidth(10, 0)
            .set_ColWidth(11, 0)
            .set_ColWidth(12, 0)
            .set_ColWidth(13, 0)
            .set_ColWidth(14, 0)
            .set_ColWidth(15, 0)
            .set_ColWidth(16, 0)
            .set_ColWidth(17, 0)
            .set_ColWidth(18, 0)
            .set_ColWidth(19, 0)
            .set_ColWidth(20, 0)
        End With
    End Sub

End Module
